package com.chb.app.controller;

import com.chb.app.mapper.HealthTestResultMapper;
import com.chb.app.service.HealthTestService;
import com.chb.app.vo.TestResultVo;
import com.hos.entity.hos.TestDetail;
import com.hos.entity.hos.TestList;
import com.hos.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：WuBai-T
 * @date ：Created in 2024/1/2 19:52
 * @description：健康测试的控制层
 * @modified By：
 * @version:
 */

@RestController
@RequestMapping("app/healthTest")
public class HealthTestController {

    @Autowired
    private HealthTestService healthTestService;

    @GetMapping("/getTestDetailById/{htId}")
   Result<List<TestDetail>>  getTestDetailById(@PathVariable String htId){
        List<TestDetail> testDetailById = healthTestService.getTestDetailById(htId);
        return new Result<List<TestDetail>>(200,"查询成功",testDetailById);
    }


    @PostMapping("/getTestResult")
    Result<TestResultVo> getTestResult(@RequestBody List<TestDetail> testDetails){
        TestResultVo testResult = healthTestService.getTestResult(testDetails);
        return new Result<TestResultVo>(200,"查询成功",testResult);
    }
    @PostMapping("/getTestResult02")
    Result<TestResultVo> getTestResult02(@RequestBody List<TestDetail> testDetails){
        TestResultVo testResult = healthTestService.getTestResult02(testDetails);
        return new Result<TestResultVo>(200,"查询成功",testResult);
    }

    @GetMapping("/getAllHealthTest")
    Result<List<TestList>> getAllHealthTest(){
        List<TestList> allHealthTest = healthTestService.getAllHealthTest();
        return new Result<List<TestList>>(200,"查询成功",allHealthTest);
    }


}